package com.longge;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class CanMakeArithmeticProgression {
    public boolean canMakeArithmeticProgression(int[] arr) {

        List<Integer> sortNums = IntStream.of(arr).sorted().boxed().collect(Collectors.toList());
        int val = sortNums.get(1) - sortNums.get(0);
        for (int i = 1; i < sortNums.size(); i++) {
            if (sortNums.get(i) - sortNums.get(i - 1) != val) return false;
        }
        return true;
    }
}
